#include "mainwindow.h"

#include <QVBoxLayout>

MainWindow::MainWindow()
    : Generator(0)
{
    ResultLabel = new QLabel("Result will be here");
    AdditionalLabel = new QLabel("Additional label");
    GenerateButton = new QPushButton("Generate");
    QFont font = ResultLabel->font();
    font.setPointSize(20);
    ResultLabel->setFont(font);

    connect(GenerateButton, SIGNAL(clicked()), this, SLOT(generate()));

    QVBoxLayout* layout = new QVBoxLayout();
    layout->addWidget(AdditionalLabel);
    layout->addWidget(ResultLabel);
    layout->addWidget(GenerateButton);
    setLayout(layout);
}

void MainWindow::setGenerator(AbstractGenerator *generator) {
    Generator = generator;
}

MainWindow::~MainWindow() {
    delete ResultLabel;
    delete GenerateButton;
}


void MainWindow::generate() {
    if (!Generator) return;
    Generator->generate();
}


QLabel* MainWindow::getResultLabel() {
    return ResultLabel;
}

QLabel* MainWindow::getAdditionalLabel() {
    return AdditionalLabel;
}
